<!-- 图片上传组件 -->
<template>
  <!-- 实际的上传组件（隐藏） -->
  <el-button type="primary" @click="handleUpload">
    <template #icon>
      <Upload />
    </template>
    导出
  </el-button>
</template>
<script setup lang="ts">
import FileAPI from "@/api/file";
const router = useRouter();
const props = defineProps({
  /**
   * 类型
   */
  type: {
    type: String,
    default: "",
  },
  /**
   * data 数据
   */
  data: {
    type: Object,
    default: (() => ({})),
  },
});

// 点击触发
const handleUpload = () => {
  let json = JSON.parse(JSON.stringify(props.data));
  delete json.ps;
  delete json.page;

  FileAPI.exportAddFile({
    type: props.type,
    where: json
  }).then(res => {
    router.push({ name: "ExporList" });
  })
}

</script>
